list1 = [1, 2, 4, 6]
list2 = [1, 3, 4]


var mergeTwoLists = function (list1, list2) {
    let list = [];
    for (let i = 0, j = 0; i < list1.length, j < list2.length;) {
        if (list1[i] < list2[j]) {
            list.push(list1[i]);
            i++;
        } else if (list1[i] > list2[j]) {
            list.push(list2[j]);
            j++;
        } else if (list1[i] === list2[j]) {
            list.push(list1[i])
            list.push(list2[j])
            i++
            j++
        }

    }
    return list
}


console.log(mergeTwoLists(list1, list2))